<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>遍历children()</title>
    <script src="../jquery-3.4.1.js"></script>
    <style>
        .left {
            width: auto;
            height: 120px;
        }
        .left div {
            width: 150px;
            height: 70px;
            padding: 5px;
            margin: 5px;
            float: left;
            background: #bbffaa;
            border: 1px solid #ccc;
        }
        a {
            display: block;
        }
    </style>
</head>
<body>
<h2>children方法()</h2>
    <div class="left first-div">
        <div class="div">
            <ul class="level-1">
                <li class="item-1">1</li>
                <li class="item-2">2</li>
                <li class="item-3">3</li>
            </ul>
        </div>
        <div class="div">
            <ul class="level-2">
                <li class="item-1">1</li>
                <li class="item-2">2</li>
                <li class="item-3">3</li>
            </ul>
        </div>
        <div class="div">
            <ul class="level-3">
                <li class="item-1">1</li>
                <li class="item-2">2</li>
                <li class="item-3">3</li>
            </ul>
        </div>
    </div>
    <button id="bt1">点击：children无参数</button>
    <button id="bt2">点击：children有参数</button>
</body>
<script>
    $("#bt1").click(function () {
        $(".div").children().css('border','3px solid red')
    });

    $("#bt2").click(function () {
        $(".div").children(":last-child").css("border","3px solid blue")
    });
    //$('.div').children(':last') 是匹配最后一个div的children <ul>
    //$('.div').children(':last-child')是所有div的最后一个儿子，也就是所有<ul>

</script>
</html>